package com.example.demo.conflg;

import com.example.demo.common.MyResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice // 控制通知器
public class ExceptionConfig { //异常拦截器
    @ExceptionHandler(Exception.class)
    public MyResult fun() {
        return MyResult.fail(-1,"出现异常");
    }
}
